#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
//喝汽水问题
/*int main()
{
	int money = 0;
	int lid = 0;
	int count = 0;
	scanf("%d", &money);
	count = lid = money;
	while (lid >= 2)
	{
		lid -= 2;
		count++;
		lid++;
	}
	printf("%d", count);
	return 0;
}
*/


/*
思路：
1. 20元首先可以喝20瓶，此时手中有20个空瓶子
2. 两个空瓶子可以喝一瓶，喝完之后，空瓶子剩余：empty/2(两个空瓶子换的喝完后产生的瓶子) + empty%2(不够换的瓶子)
3. 如果瓶子个数超过1个，可以继续换，即重复2
*/
int main()
{
	int money = 0;
	int total = 0;
	int empty = 0;


	scanf("%d", &money);
	
	//方法1
	total = money;
	empty = money;
	while(empty>1)
	{
		total += empty/2;
		empty = empty/2+empty%2;
	}


	return 0;
}


// 方法二：按照上述喝水和用瓶子换的规则的话，可以发现，其实就是个等差数列：money*2-1
int main()
{
	int money = 0;
	int total = 0;
	int empty = 0;


	scanf("%d", &money);
	
	//方法2
	if(money <= 0)
	{
		total = 0;
	}
	else
	{
		total = money*2-1;
	}
	printf("total = %d\n", total);


	return 0;
}


//打印菱形
/*int main()
{
	char arr[12][12];
	for (int i = 0; i <= 12; i++)
	{
		if (i <= 6)
		{
			for (int j = 0; j <= 12; j++)
			{
				if ((j>=6-i) && (j<=6+i))
				{
					arr[i][j] = '*';
					printf("%c", arr[i][j]);
				}
				else
				{
					printf(" ");
				}
			}
			printf("\n");
		}
		else
		{
			for (int j = 0; j <= 12; j++)
			{
				if ((j>=i-6) && (j<=18-i))
				{
					arr[i][j] = '*';
					printf("%c", arr[i][j]);
				}
				else
				{
					printf(" ");
				}
			}
			printf("\n");
		}
	}
	return 0;
}
*/


//打印水仙花数	0-100000 有1，2，3，4，5位五种可能
/*int main()
{
	int g, s, b, q, w, m;
	int a = 0;
	for (a = 0;a <= 100000; a++)
	{
		g = a % 10;
		s = (a / 10) % 10;
		b = (a / 100) % 10;
		q = (a / 1000) % 10;
		w = a / 10000;
		if ((a>=0)&&(a<10))
		{
			m = g;
			if (a == m)
			{
				printf("%d ", a);
			}
		}
		else if ((a>=10)&&(a<100))
		{
			m = g * g + s * s;
			if (a == m)
			{
				printf("%d ", a);
			}
		}
		else if ((a>=100)&&(a<1000))
		{
			m = g * g *g + s * s *s + b * b * b;
			if (a == m)
			{
				printf("%d ", a);
			}
		}
		else if ((a>=1000)&&(a<10000))
		{
			m = g * g * g *g + s * s * s * s 
				+ b * b * b * b + q * q * q * q;
			if (a == m)
			{
				printf("%d ", a);
			}
		}
		else
		{
			m = g * g * g * g *g + s * s * s * s * s 
				+ b * b * b * b * b + q * q * q * q * q + w * w * w * w * w;
			if (a == m)
			{
				printf("%d ", a);
			}
		}
	}
	return 0;
}*/

//计算求和
int main()
{
	int i = 0;
	for (i = 1; i < 10; i++)
	{
		int Sn = (i * 5) + (i * 10 * 4) + (i * 100 * 3) + (i * 1000 * 2) + (i * 10000);
		printf("%d\n", Sn);
	}
	return 0;
}
/*
思路：
通过观察可以发现，该表达式的第i项中有i个a数字，因此：
假设第i项为temp，则第i+1项为temp*10+a
具体参考以下代码
*/
int main()
{
	int a = 0;
	int n = 0;
	int i = 0;
	int sum = 0;
	int tmp = 0;


	scanf("%d%d", &a, &n);
	for(i=0; i<n; i++)
	{
		tmp = tmp*10+a;
		sum += tmp;
	}
	printf("%d\n", sum);

	return 0;
}
